#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
@AUTHOR: tyc
@VERSION: 1.0.0
@DESCRIPTION:  协程: 单线程下，当遇到io操作时 去选择处理其他工作
@time: 2021-07-04 21:22:13 
"""
import asyncio


async def func1():
    print('aaaaaaaaaa')
    await asyncio.sleep(1)
    print('aaaaaaaaaa')


# async异步协程函数
async def func2():
    print('bbbbbbbbbbb')
    await asyncio.sleep(2)
    print('bbbbbbbbbbb')


# async异步协程函数
async def func3():
    print('cccccccccccc')
    await asyncio.sleep(3)
    print('cccccccccccc')


if __name__ == '__main__':
    r1 = func1()
    r2 = func2()
    r3 = func3()
    li = [r1, r2, r3]
    # asyncio.run要求python版本不低于·3.7
    # asyncio.run(asyncio.wait(li))
    loop = asyncio.get_event_loop()
    loop.run_until_complete(asyncio.wait(li))
